package com.luchao.back.service.impl;

import com.luchao.back.mapper.UsersMapper;
import com.luchao.back.pojo.Users;
import com.luchao.back.service.UsersService;
import org.springframework.beans.factory.annotation.Autowired;
import org.springframework.stereotype.Service;

import java.util.List;

@Service
public class UsersServiceImpl implements UsersService {

    @Autowired
    private UsersMapper usersMapper;

    @Override
    public Users login(String uaccount, String upwd) {
        return usersMapper.login(uaccount, upwd);
    }

    @Override
    public int register(Users user) {
        return usersMapper.register(user);
    }

    @Override
    public int checkName(String uaccount) {
        return usersMapper.checkName(uaccount);
    }

    @Override
    public int editUsers(Users users) {
        return usersMapper.editUsers(users);
    }

    @Override
    public List<Users> getUsersByPage(int pageNum, int pageSize) {
        return usersMapper.getUsersByPage((pageNum - 1) * pageSize, pageSize);
    }

    @Override
    public long getUsersCount() {
        return usersMapper.getUsersCount();
    }

    @Override
    public Users getUsersById(int uid) {
        return usersMapper.getUsersById(uid);
    }

    @Override
    public boolean batchChangeState(List<Users> list) {
        return usersMapper.batchChangeState(list) > 0 ? true : false;
    }
}
